<?php
namespace shareTrait\Model;
/**
 * Description of ExtraFunction
 *
 * @author hardy
 */
trait DeleteData
{
    /**
     * 条件
     * @param $map
     * @return bool
     */
    function deleteOneData($map){
        if(empty($map)){
            $this->_error = '内容不存在';
            return false;
        }
        if(is_array($map)){
            $data = $this->where($map)->find();
        }else{
            $data = $this->find($map);
        }
        if(empty($data)){
            $this->_error = '内容不存在';
            return false;
        }
        $r = $this->del($data[$this->getPk()]);
        if($r === false){
            $this->_error = $this->getError();
        }
        return $r;
    }
}
